package org.sky.xmpp;

import org.jivesoftware.smack.XMPPConnection;

public class MessageUtil {
	private static XMPPConnection con;
	public MessageUtil(){
		try{
			con = IMServer.getConnection();
			con.connect();
			// 登陆
			con.login("admin", "admin");
			System.out.println("Authenticated = " + con.isAuthenticated());
		}catch(Exception e){
			e.printStackTrace();
		}
	}
	
	/**推送消息
	 * @param content 内容
	 * @param channel 频道
	 */
	public static void pushMessage(String content,String channel){
	
	}
	
	/**群发消息 xmpp
	 * @param content
	 */
	public static void sendPubMessage(String content) {
		try {
			IMServer.sendPubMsg(content,con);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	public static void main(String[] args) {
		MessageUtil mu=new MessageUtil();
		mu.sendPubMessage("123");
	}
}
